package Service;

import Entity.Hotel;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {
    static String name="cbf.db";
    static int dbVersion=1;
    public DatabaseHelper(Context context) {
        super(context, name, null, dbVersion);
    }

    public void onCreate(SQLiteDatabase db) {
        String sql="create table Order_(id INTEGER primary key  autoincrement,commo_id char (15),user_id char (15),type char(30))";
        db.execSQL(sql);


       Hotel hotel=new Hotel(0,"上海静安酒店","3","p1","上海","11234521","很好很棒","上海静安");
        sql="insert into Hotel( hotelname, star, logo,city,phone,introduce,addr) values(?,?,?,?,?,?,?)";
        Object[] obj ={hotel.getHotelname(),hotel.getStar(),hotel.getLogo(),hotel.getCity(),hotel.getPhone(),hotel.getIntroduce(),hotel.getAddr()};
        db.execSQL(sql,obj);
//
//         hotel=new Hotel(0,"北京环球影城酒店","4","p2","北京","222755252","全方位极致","通州");
//        sql="insert into Hotel( hotelname, star, logo,city,phone,introduce,addr) values(?,?,?,?,?,?,?)";
//        obj=new Object[]{ hotel.getHotelname(), hotel.getStar(), hotel.getLogo(), hotel.getCity(), hotel.getPhone(), hotel.getIntroduce(), hotel.getAddr()};
//        db.execSQL(sql,obj);
//
//         hotel=new Hotel(0,"天津酒店","5","p3","天津","1256443","设施齐全","中心城区");
//        sql="insert into Hotel( hotelname, star, logo,city,phone,introduce,addr) values(?,?,?,?,?,?,?)";
//        obj=new Object[]{ hotel.getHotelname(), hotel.getStar(), hotel.getLogo(), hotel.getCity(), hotel.getPhone(), hotel.getIntroduce(), hotel.getAddr()};
//        db.execSQL(sql,obj);
//
//        hotel=new Hotel(0,"地球酒店","1","p4","地球","44234234","房型种类多","地球村");
//        sql="insert into Hotel( hotelname, star, logo,city,phone,introduce,addr) values(?,?,?,?,?,?,?)";
//        obj=new Object[]{ hotel.getHotelname(), hotel.getStar(), hotel.getLogo(), hotel.getCity(), hotel.getPhone(), hotel.getIntroduce(), hotel.getAddr()};
//        db.execSQL(sql,obj);
//
//        hotel=new Hotel(0,"一个酒店","1","p5","到处都是","5135155","服务种类多","全国各地");
//        sql="insert into Hotel( hotelname, star, logo,city,phone,introduce,addr) values(?,?,?,?,?,?,?)";
//        obj=new Object[]{ hotel.getHotelname(), hotel.getStar(), hotel.getLogo(), hotel.getCity(), hotel.getPhone(), hotel.getIntroduce(), hotel.getAddr()};
//        db.execSQL(sql,obj);
//
//        hotel=new Hotel(0,"还行的酒店","3","p6","北京","6243466","环境好","北京西城");
//        sql="insert into Hotel( hotelname, star, logo,city,phone,introduce,addr) values(?,?,?,?,?,?,?)";
//        obj=new Object[]{ hotel.getHotelname(), hotel.getStar(), hotel.getLogo(), hotel.getCity(), hotel.getPhone(), hotel.getIntroduce(), hotel.getAddr()};
//        db.execSQL(sql,obj);



    }
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }

}
